<template>
  <div class="category-container">
    <EButton :title="'添加'" @addCate="showMessage"/>
    <CategoryList style="margin-top: 10px" :list="list"/>
    <addCategory @sendDate="getDate" ref="addCate"/>
  </div>
</template>

<script>
/*eslint-disable*/
import {getDate} from "@/utils/category";
import CategoryList from "../../components/Table/CategoryList";
import EButton from "../../components/ButtonBox/index";
import addCategory from "../../components/Dialog/addCategory";
export default {
  name: 'Category',
  data(){
    return {
      list:[]
    }
  },
  components:{
    CategoryList,
    EButton,
    addCategory
  },
  async created() {
    let res=await getDate("/porcelainType/");
    this.$store.commit('setCategory',res.data);
    this.list=res.data
  },
  methods: {
    showMessage() {
      this.$refs.addCate.changeVisible('添加分类')
    },
    getDate(res){
      this.list.push(res.cmPorcelainType)
    },
  },
}
</script>
